home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 256_02 / retry.a < prev    next >
Encoding:
Text File  |  1988-01-06  |  2.1 KB  |  56 lines

  1. ;---------------------------------------------------------------------
  2. ;    ASM88 FILE:     RETRY.A    Set how many times MS-DOS should
  3. ;    ----------                 retry a disk operation which fails
  4. ;                               because of a file-sharing violation.
  5. ;
  6. ;    WRITTEN:        25/10/87
  7. ;    -------
  8. ;    PURPOSE:        This is one of a series of files which take
  9. ;    -------         advantage of INT 21H functions under MS-DOS.
  10. ;                    In each case the error situation is marked by
  11. ;                    the carry flag being set.   We use the De Smet
  12. ;                    external variable '_carryf' to see whether the
  13. ;                    carry is set on return from the function.
  14. ;                    If so, the error code can be used to obtain
  15. ;                    information about the specific error.
  16. ;
  17. ;    USAGE:          int RETRY(num, wait, &_carryf)
  18. ;    -----           int num,  /* number of retries */
  19. ;                        wait; /* wait time between retries */
  20. ;                    char *_carryf;
  21. ;
  22. ;    DEPENDENCIES:           De Smet C V 2.44+
  23. ;    ------------
  24. ;    Copyright 1987 - Cogar Computer Services Pty. Ltd
  25. ;---------------------------------------------------------------------
  26.  
  27. CSEG
  28. PUBLIC RETRY_
  29.  
  30. RETRY_:
  31.     push    bp    ; normal De Smet C start
  32.     mov    bp,sp    ; point to the stack
  33.     mov    ax,ds    ; and make ES common with DS
  34.     mov    es,ax
  35. ;----------------------------------------------------------------------
  36. ;  The unique programme follows.
  37. ;----------------------------------------------------------------------
  38.     mov    bx,[bp+4]    ; the number of retries
  39.     mov    cx,[bp+6]    ; the wait time
  40.     mov    ah,44h    ; the Function No.
  41.     mov    al,0bh
  42.     int    21h
  43.     jc    RETRY_ERROR
  44.     xor    ax,ax    ; prepare for normal return
  45.     jmp    RETRY_QUIT
  46. RETRY_ERROR:
  47.     mov    si,[bp+8]    ; get address of '_carryf' variable
  48.     mov    byte [si],1    ; return with _carryf = 1
  49. ;----------------------------------------------------------------------
  50. ;  Normal programme termination.
  51. ;----------------------------------------------------------------------
  52. RETRY_QUIT:
  53.     pop    bp    ; restore starting conditions
  54.     ret
  55. ;----------------------------------------------------------------------
  56.